/*
 * SingInSystemMessageHolder.java
 * business
 *
 * Created by ChenTao on 2017/1/9.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.viewholder;

import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.yidiandao.business.R;
import com.yidiandao.business.data.bean.Message;
import com.yidiandao.business.ui.widget.listview.ViewHolder;
import com.yidiandao.business.utils.TextRenderUtils;
import com.yidiandao.business.utils.UIUtils;

/**
 * 系统签到通知-ViewHolder
 */
public class NormalSystemMessageHolder extends ViewHolder {

    private TextView tvContent;

    public View root;

    @Override
    protected void initView(View rootView) {
        root = rootView;
        tvContent = (TextView) rootView.findViewById(R.id.tv_content);
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_system_message_normal;
    }

    public void refreshUI(Message message) {
        if (Message.Type.ORDER_PAY.equals(message.getType())) {
            tvContent.setText(TextRenderUtils.getAssetHighlightContent(message.getContent(), UIUtils.getString(R.string.show), true));
        } else {
            if (TextUtils.isEmpty(message.getUrl())) {
                tvContent.setText(message.getContent());
            } else {
                tvContent.setText(TextRenderUtils.getAssetHighlightContent(message.getContent(), UIUtils.getString(R.string.show), !message.isRead()));
            }
        }
    }
}
